<!DOCTYPE html>
<html lang="en"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <nav class="navbar navbar-expand-sm bg-light">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" th:href="@{/}">返回首页</a>
            </li>
            <li class="nav-item">
                <a th:href="@{/back/edit}">发布文章</a>
            </li>
            <li class="nav-item">
                <a th:href="@{/logout}">新增</a>
            </li>
            <li class="nav-item">
                <a th:href="@{/back/article}">后台管理</a>
            </li>
        </ul>
    </nav>
</div>

<div class="container mt-3">
    <ul class="list-group list-group-flush">
        <li class="list-group-item" th:each="article:${articles}">
            <h3><a class="page-link" th:href="@{'/article/'+${article.getId()}}" th:text="${article.getTitle()}">标题</a></h3>
            <button type="button" class="btn btn-danger"
                    th:onclick="deleteArtcile([[${article.getId()}]])">删除</button>
            <a th:href="@{'/back/edit/'+${article.getId()}}">修改</a>
        </li>

    </ul>
</div>




</body>
<script>
    function deleteArtcile(id){
        if (confirm("确认删除？")){

            location.replace(location.protocol+"//"+location.host+"/back/article/delete/"+id);
        }
    }
</script>
</html>